<%@ page import="com.apexedu.identity.security.CasLoginUtil" %>
<%@ page import="com.apexedu.identity.entity.TSysUser" %>
<%@ page import="com.apexedu.identity.IdConstants" %>
<%@ page import="com.apexedu.portal.constant.Constants" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setAttribute("basePath", request.getContextPath());
    TSysUser user = (TSysUser) request.getSession().getAttribute(IdConstants.SESSION_USER);
    String type = (String) request.getSession().getAttribute("type");
    request.setAttribute("userid", user.getUserloginid());
    request.setAttribute("username", user.getUsername());
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="${basePath}/resources/css/mh.sd.css" rel="stylesheet">
<script type="text/javascript" src="${basePath}/clientui/js/jquery-1.4.js"></script>
<script>
    var type = '<%=type%>';
    function execLogout() {
        if (window.confirm('确定要退出系统吗？')) {
            $.get("http://ids1.suda.edu.cn/amserver/UI/Logout",function(){
                $.get("${basePath}/identity/ajaxlogin.action?act=logout", {q: (new Date()).getTime()}, function (data) {
                    data = eval("(" + data + ")");
                    if (data.msg == 'success') {
                        <%
                    if( CasLoginUtil.isSsoEnabled() ){
                    %>
                        window.location.href = '<%=CasLoginUtil.getCasServerLogoutUrl()%>';
                        <%
                        }else{
                        %>
                        window.location.href = 'http://ids1.suda.edu.cn/amserver/UI/Logout?goto=http%3A%2F%2Ftest.suda.edu.cn%3A9999%2Flogin4ids.jsp';
                        <%
                        }
                        %>
                    } else {
                        alert(data.msg);
                    }
                });
            });
            setTimeout(function(){
                <%
                if( CasLoginUtil.isSsoEnabled() ){
                %>
                window.location.href = '<%=CasLoginUtil.getCasServerLogoutUrl()%>';
                <%
                }else{
                %>
                $.get("http://ids1.suda.edu.cn/amserver/UI/Logout?goto=http%3A%2F%2Ftest.suda.edu.cn%3A9999%2Flogin4ids.jsp",function() {
                    window.location.href = 'http://ids1.suda.edu.cn/amserver/UI/Login?goto=http%3A%2F%2Ftest.suda.edu.cn%3A9999%2Flogin4ids.jsp';
                });
                <%
                }
                %>
            },1000);
        }
    }
</script>
<script type="text/javascript" src="${basePath}/resources/js/mh.sd.index.js"></script>
<div id="head">
    <div id="headline">
        <span class="infoSpan" m="infoMenu">
            <div class="infoDiv"><img alt="用户头像" src="/userinfo/${userid}" style="width: 36px; height: 36px;margin-left: 10px;"
                                      onerror="this.src='${basePath}/userinfo/user_male_portrait.png'">
                <span style="text-align: left;vertical-align: top;margin: 0 0 0 5px;width: 100px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;" title="${username}">
                    |&nbsp;&nbsp;${username}
                </span>
            </div>
            <ul class="infoMenu">
                <%if ("admin".equals(user.getUserloginid()) || "abc".equals(user.getUserloginid())) {%>
                <li onclick="location.href='/identity/index.action?flag=true'"><img
                        src="${basePath}/resources/images/8.png">管理后台
                </li>
                <%if ("admin".equals(user.getUserloginid())){ if (!Constants.MhUserType.LS.equals(type)) {%>
                <li onclick="location.href='${basePath}/s/uc/sd/i?type=ls'"><img
                        src="${basePath}/resources/images/59.png">教职工站点
                </li>
                <%
                    }
                    if (!Constants.MhUserType.LD.equals(type)) {
                %>
                <li onclick="location.href='${basePath}/s/uc/sd/i?type=ld'"><img
                        src="${basePath}/resources/images/59.png">校领导站点
                </li>
                <%
                    }
                    if (!Constants.MhUserType.XS.equals(type)) {
                %>
                <li onclick="location.href='${basePath}/s/uc/sd/i?type=xs'"><img
                        src="${basePath}/resources/images/59.png">学生站点
                </li>
                <%}
                        }
                    }
                %>
                <li onclick="window.open('${basePath}/s/uc/mh/hp')"><img
                        src="${basePath}/resources/images/11.png">头像上传
                </li>
                <li onclick="window.open('${basePath}/s/uc/mh/up')"><img
                        src="${basePath}/resources/images/47.png">修改密码
                </li>
            </ul>
        </span>
        <span class="exitSpan" onclick="execLogout()">注销</span>
    </div>
    <div id="title">
        <% if (Constants.MhUserType.XS.equals(type) || Constants.MhUserType.LS.equals(type)) {%>
        <ul class="titleUl" style="width: 564px;">
            <li onclick="location.href='${basePath}/s/uc/sd/i'" class="titleLi">首页</li>
            <li m="titleMenu1" class="titleLi">教学服务
                <div class="titleMenu titleMenu1">
                    <ul class="titleMenuLeft">
                        <li>教学服务</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <div class="dyDiv"
                         onclick="window.open('${basePath}/s/uc/se/i/navserver_WAR_nj612portlet_INSTANCE_hVunExHq6PNQ')">
                        <img src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%}%>
                </div>
            </li>
            <li m="titleMenu2" class="titleLi">学工服务
                <div class="titleMenu titleMenu2">
                    <ul class="titleMenuLeft">
                        <li>学工服务</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <div class="dyDiv"
                         onclick="window.open('${basePath}/s/uc/se/i/navserver_WAR_nj612portlet_INSTANCE_MRm2DnwdS8Lm')">
                        <img src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%}%>
                </div>
            </li>
            <li m="titleMenu3" class="titleLi">后勤服务
                <div class="titleMenu titleMenu3">
                    <ul class="titleMenuLeft">
                        <li>后勤资产</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <div class="dyDiv"
                         onclick="window.open('${basePath}/s/uc/se/i/navserver_WAR_nj612portlet_INSTANCE_Ll6bCiywMUpD')">
                        <img src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%}%>
                </div>
            </li>
            <li m="titleMenu3" class="titleLi">科研服务
                <div class="titleMenu titleMenu3">
                    <ul class="titleMenuLeft">
                        <li>科研服务</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <div class="dyDiv"
                         onclick="window.open('${basePath}/s/uc/se/i/navserver_WAR_nj612portlet_INSTANCE_Ll6bCiywMUpD')">
                        <img src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%}%>
                </div>
            </li>
            <li onclick="location.href='${basePath}/s/uc/sd/wo'" class="titleLi">流程导航</li>
        </ul>
        <%} else if (Constants.MhUserType.LD.equals(type)) {%>
        <ul class="titleUl" style="width: 564px;">
            <li onclick="location.href='${basePath}/s/uc/sd/i'" class="titleLi">首页</li>
            <li onclick="location.href='${basePath}/s/uc/sd/xssh'" class="titleLi">学习生活</li>
            <li onclick="location.href='${basePath}/s/uc/sd/jyzn'" class="titleLi">就业指南</li>
            <li onclick="location.href='${basePath}/s/uc/sd/tsst'" class="titleLi">图书社团</li>
            <li onclick="location.href='${basePath}/s/uc/mh/f?q=http://xgjw.sdxyedu.net:8790/feed/feed.do?PageOnly=true&'"
                class="titleLi">交流分享
            </li>
            <li onclick="window.open('http://jpkc.sdxyedu.net:8106/')" class="titleLi">精品课程</li>
        </ul>
        <%}%>
    </div>
    <div id="titleBottom"></div>
    <div id="logo"></div>
</div>
